package cError

import "fmt"

func New(text string, code int32) ErrorInterface {
	err := &BaseError{
		ErrCode: code,
		ErrMsg:  text,
	}

	return err
}

func Use(err ErrorInterface, text string) ErrorInterface {
	newErr := &BaseError{
		ErrCode: err.Code(),
		ErrMsg:  fmt.Sprintf("%s: %s", err.Error(), text),
	}

	return newErr
}
